Skip to content

Conversation

@celinval
Copy link
Contributor

@celinval celinval commented Nov 27, 2025

This change fixes the behavior of the name() function for CrateDef and Instance which should return absolute path of items. For local items, the crate name was missing.

This resolves: rust-lang/project-stable-mir#109

The `name()` function specifies that it returns absolute path of items,
however it wasn't including the crate name for local items.

This change fixes that.

This was reported here: rust-lang/project-stable-mir#109
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 27, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2025

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@celinval
Copy link
Contributor Author

celinval commented Nov 27, 2025

It looks like I need to do some debugging. It's not clear to me why this change affected these tests. I.e., why:

std::task::Poll::Ready -> Poll::Ready
std::option::Option::None -> Option::None

It seems to only affect std ADTs variants.

EDIT: Looking at the pretty print file, before this change, the types Option and Arguments did not include absolute path, but the variant std::option::Option::None did. This uses display not path.

Also add a check that the API works as expected for drivers calling
name on an std enum.
@rustbot
Copy link
Collaborator

rustbot commented Nov 28, 2025

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a

@oli-obk
Copy link
Contributor

oli-obk commented Nov 28, 2025

You removed with_no_trimmed_paths. If an import in a file exists that allows accessing sth via a shorter path, it gets trimmed. Std is always imported, and some types are also in the prelude. Those always get trimmed

@celinval
Copy link
Contributor Author

You removed with_no_trimmed_paths. If an import in a file exists that allows accessing sth via a shorter path, it gets trimmed. Std is always imported, and some types are also in the prelude. Those always get trimmed

Thanks @oli-obk. So how should I use with_resolve_crate_name ? Do I need to use it together with with_no_trimmed_path?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Function path is stripped of root for local crate

5 participants